<template>
	<view>

		<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">

			<uni-list>

				<view class="item" v-for="(item, index) in listdata" :key="index">

					<view style="display: inline-flex; height: 80rpx; justify-content: space-between; margin: 0 20rpx;">
						<u-icon name="order" color="#1573FF" label="过户资料" label-color="#333333"
							:customStyle="{'line-height': '80rpx',}">
						</u-icon>

						<!-- <text style="line-height: 80rpx; color: #E93131;">{{dataBean.carOutInsurance.repairStatusShow|filterNull}}</text> -->
					</view>


					<u-line color="#efefef" :customStyle="{'margin-bottom': '10rpx','display': 'block',}"></u-line>


					<view class="text-line" style="margin-top: 20rpx;">
						<text class="text-name">备注:</text>
						<text class="text-value">{{item.remarks|filterNull}}</text>
					</view>

					<view class="text-line">
						<text class="text-name">过户资料:</text>
						<text class="text-value" v-if="item.accessory.length<=0">--</text>
					</view>

					<view style="margin: 0 20rpx 20rpx 20rpx;" v-if="item.accessory.length>0">
						<u-album :urls="item.accessory"></u-album>
					</view>

					<view class="text-line">
						<text class="text-name">预计过户时间:</text>
						<text class="text-value">{{item.estimatedTransferTime|filterNull}}</text>
					</view>

					<view class="text-line">
						<text class="text-name">实际过户时间:</text>
						<text class="text-value">{{item.transferTime|filterNull}}</text>
					</view>

				</view>
			</uni-list>

		</mescroll-body>

	</view>
</template>

<script>
	import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";

	export default {
		mixins: [MescrollMixin],
		data() {
			return {
				page: 1,
				listdata: [],
				orderCarCode: '',
			}
		},
		methods: {
			getData() {
				let that = this

				this.$u.api.getdCartransfer({
						pageNo: this.page,
						inParameter: this.orderCarCode,
					}).then(
						res => {
							that.mescroll.endSuccess(res.length);

							if (that.page == 1) {
								that.listdata = [];
							}
							that.listdata = that.listdata.concat(res);

							//造假数据
							// that.listdata = [{
							// 		transferId: '2',
							// 		estimatedTransferTime: '2020-08-03',
							// 		transferTime: '2020-08-05',
							// 		createTime: '2020-08-08',
							// 		remarks: '测试过户',
							// 		operator: 'lztest',
							// 		accessory: ["ERBA/idCard_images/3c/9b/b0ac4a9bff3546beb65e3d7413123c9b.jpg",
							// 			"ERBA/license_images/62/fd/cc96cafd29d74aeb920240c1bf9062fd.jpg"
							// 		]
							// 	},
							// 	{
							// 		transferId: '2',
							// 		estimatedTransferTime: '2020-08-03',
							// 		transferTime: '2020-08-05',
							// 		createTime: '2020-08-08',
							// 		remarks: '测试过户',
							// 		operator: 'lztest',
							// 		accessory: []
							// 	},
							// 	{
							// 		transferId: '2',
							// 		estimatedTransferTime: '2020-08-03',
							// 		transferTime: '2020-08-05',
							// 		createTime: '2020-08-08',
							// 		remarks: '测试过户',
							// 		operator: 'lztest',
							// 		accessory: ["ERBA/idCard_images/3c/9b/b0ac4a9bff3546beb65e3d7413123c9b.jpg",
							// 			"ERBA/license_images/62/fd/cc96cafd29d74aeb920240c1bf9062fd.jpg"
							// 		]
							// 	},
							// ]

							if (!uni.$u.test.isEmpty(that.listdata)) {
								that.listdata = that.listdata.map(item => {
									if (!uni.$u.test.isEmpty(item.accessory)) {
										item.accessory = item.accessory.map(sitem => {
											return that.baseImgUrl() + sitem
										})
									}

									return item
								})
							}

						}
					)
					.catch(() => {
						this.mescroll.endErr();
					})
			},

			upCallback(page) {
				console.log("触发了上拉加载" + page);

				this.page = page.num;
				this.getData();
			},
		},

		onLoad(op) {
			this.orderCarCode = op.orderCarCode;
		},
	}
</script>

<style lang="scss" scoped>
</style>
